#include <iostream>
using namespace std;
using ll=long long;
int main() {

	ll a,h,b,k;
	cin>>a>>h>>b>>k;
	ll n1=h/b;
	ll n2=k/a;
	if(h%b!=0){
		++n1;
	}
	if(k%a!=0){
		++n2;
	}
	ll n=min(n1,n2);
	ll sum=(a+b)*n;
	h-=n*b;
	k-=n*a;
	if(h>0){
		sum+=a*10;
	}
	else if(k>0){
		sum+=b*10;
	}
	cout<<sum<<endl;
	
	return 0;
}
